package com.jvyou.pms.controller;

import com.jvyou.common.response.R;
import com.jvyou.pms.domain.dto.DashboardDto;
import com.jvyou.pms.service.DashboardService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 仪表盘相关接口
 *
 * @author 橘柚
 * @since 2025/6/29 01:29
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/dashboard")
public class DashboardController {

    private final DashboardService dashboardService;

    /**
     * 获取每种设备类型的数量
     *
     * @param dto
     * @return
     */
    @PostMapping(value = "/getNumBySblx")
    public R<List<Map<String, Object>>> getNumBySblx(@RequestBody DashboardDto dto) {
        return R.ok(dashboardService.getNumBySblx(dto.getSblxList(), dto.getYq()));
    }

    @PostMapping(value = "/getAllSbNum")
    public R<Integer> getAllSbNum(@RequestBody DashboardDto dto) {
        return R.ok(dashboardService.getAllSbNum(dto.getYq()));
    }

    @PostMapping(value = "/getSbcsInfo")
    public R<List<Map<String, Object>>> getSbcsInfo(@RequestBody DashboardDto dto) {
        return R.ok(dashboardService.getSbcsInfo(dto));
    }

}
